import { Instance, SnapshotOut, types } from "mobx-state-tree"

import { AgentsModel, createAgentsInitialSnapshot } from "./Agents"
import { ConfigModel } from "./Config"
import { ConversationsModel, createConversationsInitialSnapshot } from "./Conversations"
import { ProductStoreModel, createProductInitialSnapshot } from "./Product"
import { SystemModel } from "./System"
import { UserModel } from "./User"

export const RootStoreModel = types.model("RootStore").props({
  userStore: types.optional(UserModel, {}),
  systemStore: types.optional(SystemModel, {}),
  configStore: types.optional(ConfigModel, {}),
  conversationsStore: types.optional(ConversationsModel, createConversationsInitialSnapshot),
  agentsStore: types.optional(AgentsModel, createAgentsInitialSnapshot),
  productStore: types.optional(ProductStoreModel, createProductInitialSnapshot),
})

export interface RootStore extends Instance<typeof RootStoreModel> {}

export interface RootStoreSnapshot extends SnapshotOut<typeof RootStoreModel> {}
